package com.set.mobileapp.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class LovAdapter extends BaseAdapter {

	private List<LovItem> menuList;
	private Context ctx;

	public LovAdapter(List<LovItem> m, Context context) {
		this.menuList = m;
		this.ctx = context;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return menuList.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return menuList.get(arg0).getValue();
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		// TODO Auto-generated method stub
		TextView tv = null;
		if (arg1 == null) {
			tv = new TextView(this.ctx);
		} else {
			tv = (TextView) arg1;
		}
		LovItem item = this.menuList.get(arg0);
		tv.setText(item.getLable());

		return tv;
	}

}
